package parion.mylistview;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class ItemView extends LinearLayout{
	
	ImageView image;
	TextView name;
	TextView age;
	Profile mProfile;
	OnImageClickListener mLitener;
	public interface OnImageClickListener{
		public void onImageClick(Profile profile);
	}
	
	
	
	public void setOnImageClickListener(OnImageClickListener Litener){
		mLitener=Litener;
	}
	 ItemView(Context context) {
		super(context);
		// TODO Auto-generated constructor stub	
		LayoutInflater inflater = LayoutInflater.from(context);
		inflater.inflate(R.layout.listview_layout, this);
		
		image = (ImageView)findViewById(R.id.imageView1);
		image.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				
			}
		});
		
		name = (TextView)findViewById(R.id.textView1);
		age = (TextView)findViewById(R.id.textView2);
	}
	 
	 public void setData(Profile profile){
		 mProfile = profile;
		 name.setText(mProfile.name);
		 age.setText(Integer.toString(mProfile.age));
		 image.setImageResource(mProfile.image);
	 }

	
	
	

}
